﻿using System;

using SBPweb.Forge.Controls.Silverlight;

namespace SBPweb.Accelerators.StreetView.Client.BingMapsProvider.Controllers
{

    public class ControllerBase
    {

        #region Constructor logic

        #endregion

        #region Property accessors

        public static ExtendableApplication Application
        {
            get
            {
                return System.Windows.Application.Current as ExtendableApplication;
            }
        }

        #endregion

        #region Methods

        public static void RegisterModel<T>(T model)
        {
            Type t = typeof(T);
            RegisterModel<T>(t.FullName, model);
        }

        public static void RegisterModel<T>(string key, T model)
        {
            Application.Put<T>(key, model);
        }

        public static T FetchModel<T>()
        {
            Type t = typeof(T);
            return FetchModel<T>(t.FullName);
        }

        public static T FetchModel<T>(string key)
        {
            return Application.Get<T>(key);
        }

        #endregion

    }

}